@model CreateTokenViewModel
@{
    var store = Context.GetStoreData();
    ViewData.SetLayoutModel(new(nameof(StoreNavPages.Tokens), StringLocalizer["Create New Token"]));
    ViewBag.HidePublicKey ??= false;
    ViewBag.ShowStores ??= false;
}

<form method="post">
    <div class="sticky-header">
        @if (store != null)
        {
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item">
                        <a asp-action="ListTokens" asp-route-storeId="@store.Id" text-translate="true">Access Tokens</a>
                    </li>
                    <li class="breadcrumb-item active" aria-current="page">@ViewData["Title"]</li>
                </ol>
                <h2>@ViewData["Title"]</h2>
            </nav>
        }
        else
        {
            <h2>@ViewData["Title"]</h2>
        }
        <input id="page-primary" type="submit" value="Request Pairing" class="btn btn-primary" />
    </div>
    <partial name="_StatusMessage" />
    <div class="row">
        <div class="col-xxl-constrain col-xl-8">
            <div class="form-group">
                <label asp-for="Label" class="form-label"></label>
                @if (ViewBag.HidePublicKey)
                {
                    <small class="text-muted" text-translate="true">optional</small>
                }
                <input asp-for="Label" class="form-control" />
                <span asp-validation-for="Label" class="text-danger"></span>
            </div>
            @if (!ViewBag.HidePublicKey)
            {
                <div class="form-group">
                    <label asp-for="PublicKey" class="form-label"></label>
                    <input asp-for="PublicKey" class="form-control" />
                    <span asp-validation-for="PublicKey" class="text-danger"></span>
                    <div class="form-text" text-translate="true">Keep empty for server-initiated pairing.</div>
                </div>
            }
            @if (ViewBag.ShowStores)
            {
                <div class="form-group">
                    <label asp-for="Stores" class="form-label"></label>
                    <select asp-for="StoreId" asp-items="Model.Stores" class="form-select"></select>
                    <span asp-validation-for="StoreId" class="text-danger"></span>
                </div>
            }
            else
            {
                <input type="hidden" asp-for="StoreId" />
            }
        </div>
    </div>
</form>
